package com.gx.mvp.ui.main;

import android.view.View;
import android.widget.TextView;
import com.gx.mvp.R;
import com.gx.mvp.base.BaseActivity;

/**
 * Created by Guoxin on 2019/12/05.
 */
public class MainActivity extends BaseActivity<MainPresenter> implements MainView.View {

    private TextView mTextView;

    private String mAccount;
    private String mPassword;

    @Override
    protected MainPresenter createPresenter() {
        return new MainPresenter(this, this);
    }

    @Override
    protected int getContentViewId() {
        return R.layout.activity_main;
    }

    @Override
    protected void initView() {
        this.mTextView = findViewById(R.id.text);
    }

    @Override
    protected void initData() {
        this.mAccount = "test";
        this.mPassword = "123456";
    }

    @Override
    protected void initListener() {
        this.mTextView.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        super.onClick(v);
        switch (v.getId()){
            case R.id.text:
                this.mPresenter.test(mAccount, mPassword);
                break;
        }
    }

    @Override
    public void onSuccess() {
        // 处理请求成功逻辑
    }

    @Override
    public void onError() {
        // 处理请求失败逻辑
    }
}